import * as React from 'react';
import { useLocation } from './hooks';

export const Route: React.FC<any> = (props: any) => {
  const { path, component } = props;
  const Component = component;
  const location = useLocation();
  const isMatch = path === location.pathname;
  if (isMatch) {
    return <Component />;
  }
  return null;
};
